<%@page contentType="text/html;charset=UTF-8" session="false" %>
<%@include  file="/WEB-INF/jspf/import.jspf"%>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" id="pagerForm" name="searchForm" method="post">
        <input type="hidden" name="pageNum" value="${pager.pageNo}" />
        <input type="hidden" name="pageSize" value="${pager.pageSize}" />
        <input type="hidden" name="orderField" value="${orderField}" />
        <input type="hidden" name="orderDirection" value="${orderDirection}" />
        <div class="searchBar">
            <table class="searchContent">
                <tbody>
                    <tr>
                        <td><label>消息Id：</label><input type="text" name="msgId" value="${msgId}" class="textInput"></td>
                        <td><label>消息内容：</label><input type="text" name="msg" value="${msg}" class="textInput"></td>
                        <td><label>发送时间：</label>
                            <input type="text" value="${beginDate}" name="beginDate" datefmt="yyyy-MM-dd 00:00:00" class="date" readonly="true">
                            至
                            <input type="text" value="${endDate}" name="endDate" datefmt="yyyy-MM-dd 23:59:59" class="date" readonly="true">
                        </td>
                        <td><label>创建者ID:</label><input type="text" name="createBy" value="${createBy}" class="textInput"></td>
                    </tr>
                </tbody>
            </table>
            <div class="subBar">
                <ul>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
                </ul>
            </div>
        </div>
    </form>
</div>

<div class="panelBar">
    <ul class="toolBar">
        <li><a class="icon" href="${ROOT}/admin/message/detail.do?msgId=0"  target="navTab" rel="message-detail" title="创建信息"><span>创建信息</span></a></li>
    </ul>
</div>
<div class="pageContent">
    <table class="table" style="width: 100%" layoutH="136">
        <thead>
            <tr>
                <th width="5%">Id</th>
                <th width="30%">消息内容</th>
                <th width="5%">发送数量</th>
                <th width="4%">已发送</th>
                <th width="11%">创建时间</th>
                <th width="11%">发送时间</th>
                <th width="6%">创建者ID</th>
                <th width="9%">状态</th>
                <th width="5%">操作</th>
                <th width="5%">删除</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach var="item" items="${pager.resultList}">
                <tr>
                    <td data-updateBy="${item.updateBy}" data-updateAt="<fmt:formatDate value="${item.updateAt}" pattern="yyyy-MM-dd HH:mm:ss"/>">${item.msgId}</td>
                    <td>${fn:escapeXml(item.content)}</td>
                    <td>${item.sendNum}</td>
                    <td>${item.sendNum - item.lessNum}</td>
                    <td><fmt:formatDate value="${item.createAt}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td><fmt:formatDate value="${item.sendAt}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td>${item.createBy}</td>
                    <td>
                        <c:if test="${item.createStatus==0}">
                         <c:if test="${item.status==1 }"><a href="${ROOT}/admin/message/send.do?msgId=${item.msgId}&status=2" title="确定要发送该消息吗？此操作不能后退！" target="ajaxTodo" style="color: blue;">发送<a></c:if>
                         <c:if test="${item.status==2 }">发送准备中</c:if>
                         <c:if test="${item.status==3 }">发送中</c:if>
                         <c:if test="${item.status==4}">发送已完成</c:if>
                         <c:if test="${item.status==5}">重发准备中</c:if>
                         <c:if test="${item.status==4 and item.lessNum>0 }"><a href="${ROOT}/admin/message/send.do?msgId=${item.msgId}&status=5" title="确定要重发该消息吗？此操作不能后退！" target="ajaxTodo" style="color: blue;">重发<a></c:if>
                        </c:if>
                        <c:if test="${item.createStatus==1}">正在创建中</c:if>
                        <c:if test="${item.createStatus==2}">未创建</c:if>
                    </td>
                    <td>
                        <a class="btnLook" href="${ROOT}/admin/message/detail.do?msgId=${item.msgId}"
                           target="navTab" rel="message-detail" title="查看详情">查看</a>
                    </td>
                    <td>
                    	<a href="${ROOT}/admin/message/delete.do?msgId=${item.msgId}" title="确定要删除该消息吗？此操作不能后退！" target="ajaxTodo" class="btnDel"><a>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</div>
<div class="panelBar">
    <div class="pages">
        <span>共 ${pager.total} 条</span>
    </div>
    <div class="pagination" targetType="navTab" totalCount="${pager.total}" numPerPage="${pager.pageSize}" pageNumShown="10" currentPage="${pager.pageNo}"></div>
</div>

